import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import active from '../components/active.vue'
import error from '../components/error.vue'
import Foo from '../components/foo.vue'
Vue.use(Router)

let  router= new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/active',
      // redirect:"/foo",
      component: active,
      // beforeEnter:((to,from,next)=>{
      //   next()
      // })
    },
    {
      path:'/foo/:id',
      component:Foo,
      name:'Foo',
      // alias:"/miss"
    },
    {
      path: '/m-*',
      component: error,
    }
  ]
})
// router.beforeEach((to,from,next)=>{
//   console.log('全局前置守卫')
//   console.log(to)
//   console.log(from)
//   next()
// })

// router.beforeResolve((to,from,next)=>{
// console.log("beforeResolve--全局解析守卫")
// })

// router.afterEach((to,from) => {
//   console.log('y4ty6-后置钩子')
// })
export  default router
